#include <cstdio>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
int read(){
	char c=getchar();int x=0;
	while(c<48||c>57) c=getchar();
	do x=(x<<1)+(x<<3)+(c^48),c=getchar();
	while(c>=48&&c<=57);
	return x;
}
typedef long long ll;
typedef vector<int> vi;
const int Lm=80;
const int N=600003,T=83;
const ll INF=0x3f3f3f3f3f3f3f3f;
int q[N];
ll f[N],_f[N];
int ec[T],ew[T],ev[T];
int main(){
	freopen("book.in","r",stdin);
	freopen("book.out","w",stdout);
	int n=read();
	for(int i=0;i<n;++i) ec[i]=read();
	for(int i=0;i<n;++i) ew[i]=read();
	for(int i=0;i<n;++i) ev[i]=read();
	int lim=read();
	vi seq(n);
	iota(seq.begin(),seq.end(),0);
	sort(seq.begin(),seq.end(),[&](int x,int y){
			return (ll)ev[x]*ew[y]>(ll)ev[y]*ew[x];
		});
	int sm=0;
	f[0]=0;
	for(int p=0;p<n;++p){
		int pc=min(ec[p],Lm);ec[p]-=pc;pc*=ew[p];
		int tsm=min(sm+pc,lim);
		for(int i=0;i<=sm;++i) _f[i]=f[i]-(ll)(i/ew[p])*ev[p];
		for(int t=0;t<ew[p];++t){
			int hd=1,tl=0;
			for(int i=t;i<=tsm;i+=ew[p]){
				if(i<=sm){
					while(hd<=tl&&_f[q[tl]]<=_f[i]) --tl;
					q[++tl]=i;
				}
				while(hd<=tl&&q[hd]<i-pc) ++hd;
				if(hd<=tl) f[i]=_f[q[hd]]+(ll)(i/ew[p])*ev[p];
				else f[i]=-INF;
			}
		}
		sm=tsm;
	}
	ll res=0;
	for(int i=0;i<=sm;++i){
		int cw=lim-i;ll cv=f[i];
		for(int j=0;j<n;++j){
			int x=seq[j];
			int cc=min(cw/ew[x],ec[x]);
			cw-=(ll)ew[x]*cc;cv+=(ll)ev[x]*cc;
		}
		if(cv>res) res=cv;
	}
	printf("%lld\n",res);
	return 0;
}
